from alg import Solution
from gen import generate_test_cases
import time

def test_algorithm():
    """
    测试盛最多水的容器算法
    """
    solution = Solution()
    test_cases = generate_test_cases()
    
    print("开始测试盛最多水的容器算法...")
    print("-" * 50)
    
    for i, case in enumerate(test_cases, 1):
        # 记录开始时间
        start_time = time.time()
        
        # 执行算法
        result = solution.maxArea(case)
        
        # 计算执行时间
        execution_time = (time.time() - start_time) * 1000  # 转换为毫秒
        
        # 打印结果
        print(f"测试用例 {i}:")
        print(f"输入: {case}")
        print(f"输出: {result}")
        print(f"执行时间: {execution_time:.2f}ms")
        print("-" * 50)

if __name__ == "__main__":
    test_algorithm() 